package com.class5.springboot.frame.repo.tool.xml;
import java.util.ArrayList;

import java.util.List;
/**
 * 字典组
 * @author Administrator
 */
public class DbCodeGroup {
    private List<DbCodeItem> items = new ArrayList<DbCodeItem>();

    private String className;
    private String type;
    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }
    /**
     * 获取备注串
     * @return
     */
    public String getComment(){
        StringBuffer sb = new StringBuffer();
        for(DbCodeItem item : items){
            sb.append(item.getValue() + ":" + item.getText() + ",");
        }
        return sb.substring(0, sb.length()-1);
    }

    public List<DbCodeItem> getItems() {
        return items;
    }

    public void setItems(List<DbCodeItem> items) {
        this.items = items;
    }
    public DbCodeItem getByField(String name){
        for(DbCodeItem item : items){
            if(item.getField().equals(name))
                return item;
        }
        return null;
    }
}